<template>
  <div>login</div>
  <van-button type="primary" @click="login">登录</van-button>
</template>

<script setup lang="ts">
import { sessions } from 'mosowejs'
import { useLogin,useUserInfo } from '@/store/index.ts'
const loginStore = useLogin()
const userStore = useUserInfo()
const router = useRouter()

const login = () => {
  const token = '123456'
  const userInfo = {name:'测试'}
  sessions.set('token',token)
  sessions.set('userInfo',userInfo)
  loginStore.PI_TOKEN = token // pinia:设置token
  loginStore.PI_IS_LOGIN = true // pinia:设置已登录
  userStore.PI_USER_INFO = userInfo

  let page:any = router.currentRoute.value.query.redirect
  router.replace(page)
}
</script>


<style lang="less">
</style>
